package com.bishe.demo.modules.hotel.hotelPolicy.dao;

import com.bishe.demo.modules.hotel.hotelPolicy.entity.CheckType;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface CheckTypeDao {
    @Insert("insert into hotel_check_type values(null,#{checkTypeName})")
    @Options(useGeneratedKeys = true, keyProperty = "checkTypeId", keyColumn = "check_type_id")
    void insertCheckType(CheckType checkType);

    @Select("select * from hotel_check_type hct left join hotel_policy_check_type hpcy on hpcy.check_type_id=hct.check_type_id where hpcy.policy_id=#{policyId}")
    CheckType getCheckTypeByPolicyId(int policyId);

    @Delete("delete from hotel_check_type where check_type_id=#{checkTypeId}")
    void deleteByCheckTypeId(int checkTypeId);
}
